(function($){ "use strict"; jQuery(document).on('ready', function () { window.onload = function(){ // Preloader const getPreloaderId = document.getElementById('preloader'); if (getPreloaderId) { getPreloaderId.style.display = 'none'; } //Feather Icons feather.replace() }; // Mobile Menu $('.menu li.menu-item-has-children>a').on('click', function(){ $(this).removeAttr('href'); var element = $(this).parent('li'); if (element.hasClass('open')) { element.removeClass('open'); element.find('li').removeClass('open'); element.find('ul').slideUp(); } else { element.addClass('open'); element.children('ul').slideDown(); element.siblings('li').children('ul').slideUp(); element.siblings('li').removeClass('open'); element.siblings('li').find('li').removeClass('open'); element.siblings('li').find('ul').slideUp(); } }); $('.menu>ul>li.menu-item-has-children>a').append(''); // Saving Calculator var storedInitialDeposit = parseFloat(localStorage.getItem('initial-deposit')); var storedMonthlyDeposit = parseFloat(localStorage.getItem('monthly-deposit')); var storedDuration = parseInt(localStorage.getItem('duration')); var storedApyPercentage = parseFloat(localStorage.getItem('apy')); if (!isNaN(storedInitialDeposit)) { $("#initial-deposit").val(storedInitialDeposit); } if (!isNaN(storedMonthlyDeposit)) { $("#monthly-deposit").val(storedMonthlyDeposit); } if (!isNaN(storedDuration)) { $("#duration").val(storedDuration); } if (!isNaN(storedApyPercentage)) { $("#apy").val(storedApyPercentage); } // Function to calculate and display the result function calculateSavings() { var initialDeposit = parseFloat($("#initial-deposit").val()); var monthlyDeposit = parseFloat($("#monthly-deposit").val()); var duration = parseInt($("#duration").val()); var apyPercentage = parseFloat($("#apy").val()); // Convert APY percentage to a decimal, e.g., 4.00% to 0.04 var apy = apyPercentage / 100 / 12; var savings = initialDeposit; for (var i = 1; i <= duration; i++) { savings += monthlyDeposit; savings *= (1 + apy); // Compounding monthly } // Display the result $(".saving-calculator .form-btn .result").text("$" + savings.toFixed(2)); $("#apy-result").text(apyPercentage.toFixed(2)); // Store the input values in localStorage localStorage.setItem('initial-deposit', initialDeposit); localStorage.setItem('monthly-deposit', monthlyDeposit); localStorage.setItem('duration', duration); localStorage.setItem('apy', apyPercentage); } // Calculate and display the result when the form is submitted $("#savings-form").submit(function (event) { event.preventDefault(); calculateSavings(); }); // Calculate and display the result on page load $(document).ready(function () { calculateSavings(); }); // Calculate function function calculateInterest() { const initialAmount = parseFloat($('#initial-amount').val()); const savingDuration = parseInt($('#saving-duration').val()); const annualInterest = parseFloat($('#annual-interest').val()) / 100; // Convert to decimal // Calculate interest based on the annual interest rate and the correct duration const monthlyInterestRate = annualInterest / 12; const interest = initialAmount * monthlyInterestRate * savingDuration; const totalSavings = initialAmount + interest; // Update the result and total savings on the page $('.result').text('$' + interest.toFixed(2)); $('#total-savings').text('$' + totalSavings.toFixed(2)); } // Calculate on button click $('#calculate-button').click(function (e) { e.preventDefault(); // Prevent the form from submitting and page reloading calculateInterest(); }); // Calculate on page load (optional) calculateInterest(); }); $( window ).on( 'elementor/frontend/init', function() { elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) { // Category Slider var swiper = new Swiper(".category-slider", { spaceBetween: 20, grabCursor: true, loop: false, speed:1400, autoHeight: true, navigation: { nextEl: ".category-next", prevEl: ".category-prev", }, breakpoints: { 0: { slidesPerView: 2 }, 768: { slidesPerView: 3 }, 992: { slidesPerView: 4 }, 1200: { slidesPerView: 5 }, 1400: { slidesPerView: 6 } } }); // News Slider var swiper = new Swiper(".news-slider", { spaceBetween: 20, grabCursor: true, loop: false, speed:1400, autoHeight: true, pagination: { el: ".news-pagination", clickable:true }, breakpoints: { 0: { slidesPerView: 1 }, 768: { slidesPerView: 2 }, 992: { slidesPerView: 1.2 }, 1200: { slidesPerView: 2 }, 1300: { slidesPerView: 2.1 }, 1400: { slidesPerView: 2.4 }, 1600: { slidesPerView: 2.63 } } }); // Card Slider var swiper = new Swiper(".card-slider-one", { spaceBetween: 20, grabCursor: true, loop: false, speed:1400, autoHeight: true, pagination: { el: ".card-pagination", clickable:true }, breakpoints: { 0: { slidesPerView: 1 }, 768: { slidesPerView: 2 }, 992: { slidesPerView: 2 }, 1200: { slidesPerView: 3 } } }); // Testimonial Slider var swiper = new Swiper(".testimonial-slider-one", { spaceBetween: 25, grabCursor: true, loop: false, speed:1400, autoplay: { delay: 3000, disableOnInteraction: false }, pagination: { el: ".testimonial-pagination", clickable: true }, breakpoints: { 0: { slidesPerView: 1 }, 768: { slidesPerView: 2 }, 992: { slidesPerView: 1 }, 1200: { slidesPerView: 2 } } }); var swiper = new Swiper(".testimonial-slider-two", { spaceBetween: 25, grabCursor: true, loop: false, speed:1400, autoplay: { delay: 3000, disableOnInteraction: false }, pagination: { el: ".testimonial-pagination", clickable: true }, breakpoints: { 0: { slidesPerView: 1 }, 768: { slidesPerView: 2 }, 992: { slidesPerView: 2 }, 1200: { slidesPerView: 3 } } }); var swiper = new Swiper(".testimonial-slider-three", { spaceBetween: 25, grabCursor: true, slidesPerView: 1, loop: false, speed:1400, autoHeight: true, pagination: { el: ".testimonial-pagination", clickable: true } }); var swiper = new Swiper(".service-slider-one", { spaceBetween: 20, grabCursor: true, loop: false, slidesPerView: 1, speed:1400, autoHeight: true, pagination: { el: ".service-pagination", clickable:true, type: "fraction" }, navigation: { nextEl: ".service-button-next", prevEl: ".service-button-prev", } }); var swiper = new Swiper(".case-slider-two", { spaceBetween: 20, grabCursor: true, loop: false, speed:1400, autoHeight: true, pagination: { el: ".case-pagination", clickable:true }, breakpoints: { 0: { slidesPerView: 1 }, 768: { slidesPerView: 2 }, 992: { slidesPerView: 2 }, 1200: { slidesPerView: 3 }, 1400: { slidesPerView: 4 } } }); // AOS AOS.init({ startEvent: 'load' }); // Counter Js if ("IntersectionObserver" in window) { let counterObserver = new IntersectionObserver(function (entries, observer) { entries.forEach(function (entry) { if (entry.isIntersecting) { let counter = entry.target; let target = parseInt(counter.innerText); let step = target / 200; let current = 0; let timer = setInterval(function () { current += step; counter.innerText = Math.floor(current); if (parseInt(counter.innerText) >= target) { clearInterval(timer); } }, 10); counterObserver.unobserve(counter); } }); }); let counters = document.querySelectorAll(".counter"); counters.forEach(function (counter) { counterObserver.observe(counter); }); } }); }); }(jQuery)); function initializeBackToTopButton() { const topButton = document.getElementById("backtotop"); if (topButton) { // Ensure the button is hidden initially topButton.style.opacity = "0"; // Scroll to top on click topButton.onclick = function () { window.scrollTo({ top: 0, behavior: "smooth" }); }; // Show/hide button on scroll window.onscroll = function () { const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; if (scrollTop > 200) { topButton.style.opacity = "1"; } else { topButton.style.opacity = "0"; } }; } } // Initialize when the DOM is fully loaded window.addEventListener("load", initializeBackToTopButton);